<template>
  <figure>
    <div class="img-box" v-if="item.thumb">
      <img :src="item.thumb" :alt="item.title" class="fluid-img" />
    </div>
    <figcaption>
      <div class="item-intro">
        <time class="item-date">{{item.date}}</time>
        <span class="item-cate">{{item.cate}}</span>
      </div>
      <h3 class="item-title">{{item.title}}</h3>
      <div class="item-description" v-if="item.description" v-text="item.description"></div>
      <div class="item-download" v-if="item.download">
        {{item.download}}
        <i class="icon-download"></i>
      </div>
    </figcaption>
  </figure>
</template>
<script>
export default {
  name: "NewsItem",
  props: {
    item: {
      type: Object
    }
  }
};
</script>
<style lang="scss" scoped>
figure {
  position: relative;
  margin: 0 20px;
  &::before {
    content: "";
    position: absolute;
    z-index: 2;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    border: 1px solid #fff;
    opacity: 0;
    -webkit-transition: all 0.2s;
    transition: all 0.2s;
  }
  &:hover {
    &::before {
      top: 12px;
      right: 12px;
      bottom: 12px;
      left: 12px;
      opacity: 1;
    }
    .item-title {
      color: $primary;
    }
  }
  figcaption {
    margin-top: 10px;
    background-color: #f5f5f5;
    height: 200px;
    padding: 40px 40px 0;
    z-index: 5;
    position: relative;
    .item-date,
    .item-cate {
      font: 300 14px/20px "Futura";
      color: #888;
      letter-spacing: 0.02em;
    }
    .item-cate {
      margin-left: 5px;
      padding-left: 5px;
    }
    .item-description {
      margin-top: 0.5em;
      font: 500 14px/2 "Futura";
      color: gray;
    }
    h3.item-title {
      margin-top: 0.75em;
      max-height: 3.6em;
      overflow: hidden;
      font: 700 20px/1.8 "Futura";
      color: #202020;
      letter-spacing: 0.02em;
      transition: color 0.3s;
    }
    .item-download {
      position: absolute;
      right: 20px;
      bottom: 20px;
      font: 300 14px/20px "Futura";
      letter-spacing: 0.02em;
      color: gray;
    }
    i.icon-download {
      margin-left: 1em;
      font-size: 16px;
      line-height: 20px;
      color: #2537b5;
      display: inline-block;
      vertical-align: top;
      font-family: "iconfont";
      -moz-osx-font-smoothing: grayscale;
      -webkit-font-smoothing: antialiased;
      font-style: normal;
      font-variant: normal;
      line-height: 1;
      speak: none;
      text-transform: none;
      &::before {
        content: "\e686";
      }
    }
  }
}
</style>